﻿using DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.WorksheetElements;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.StyleElements
{
    [XmlRoot("xf", Namespace = Constants.ExcelMain)]
    public class FormattingElement : XmlSerializable
    {
        #region Attributes

        [Optional]
        [XmlAttribute("numFmtId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> NumberFormatId { get; set; }

        [Optional]
        [XmlAttribute("fontId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> FontId { get; set; }

        [Optional]
        [XmlAttribute("fillId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> FillId { get; set; }

        [Optional]
        [XmlAttribute("borderId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> BorderId { get; set; }

        [Optional]
        [XmlAttribute("xfId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> FormatId { get; set; }

        [Optional]
        [XmlAttribute("quotePrefix", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> QuotePrefix { get; set; }

        [Optional]
        [XmlAttribute("pivotButton", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> PivotButton { get; set; }

        [Optional]
        [XmlAttribute("applyNumberFormat", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> ApplyNumberFormat { get; set; }

        [Optional]
        [XmlAttribute("applyFont", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> ApplyFont { get; set; }

        [Optional]
        [XmlAttribute("applyFill", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> ApplyFill { get; set; }

        [Optional]
        [XmlAttribute("applyBorder", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> ApplyBorder { get; set; }

        [Optional]
        [XmlAttribute("applyAlignment", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> ApplyAlignment { get; set; }

        [Optional]
        [XmlAttribute("applyProtection", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> ApplyProtection { get; set; }

        #endregion

        #region Elements

        [Optional]
        [XmlElement("alignment", Namespace = Constants.ExcelMain)]
        public Alignment Alignment { get; set; }

        [Optional]
        [XmlElement("protection", Namespace = Constants.ExcelMain)]
        public Protection Protection { get; set; }

        [Optional]
        [XmlElement("extLst", Namespace = Constants.ExcelMain)]
        public ExtensionList ExtensionList { get; set; }

        #endregion

        public FormattingElement() { }
    }
}
